package com.excesys.exsecs.energy.mapper;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.excesys.exsecs.common.data.datascope.ExsecsBaseMapper;
import com.excesys.exsecs.energy.dto.BamSSubareaDTO;
import com.excesys.exsecs.energy.dto.DeviceOnlineInfoDTO;
import com.excesys.exsecs.energy.entity.RegDev;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface RegDevMapper extends ExsecsBaseMapper<RegDev> {

	Page<RegDev> queryPage(@Param("page") Page page, @Param("rd") RegDev regDev);

	List<RegDev> queryRegDevList(@Param("unitNos") List<String> unitNos);

	List<BamSSubareaDTO> queryBamSSubareaDTOList(@Param("subareaCodes") List<String> subareaCodes);

	RegDev queryRegDev(@Param("unitNo")String unitNo);

	/**
	 * 通过unitNo获取设备信息
	 * @return
	 */
	@Select("SELECT * FROM  twinopsx_em.em_device_online_info info WHERE info.unit_no = #{unitNo}")
	DeviceOnlineInfoDTO queryDeviceOnlineInfo(@Param("unitNo") String unitNo);

	/**
	 * 通过subareaCode获取区域信息
	 * @return
	 */
	@Select("SELECT * FROM  twinopsx_bm.bam_s_subarea area WHERE area.subarea_code = #{subareaCode}")
	BamSSubareaDTO queryBamSSubareaDTO(@Param("subareaCode") String subareaCode);

	//表计图表
	List<Map<String, Object>> chartPower(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("unitNoList") List<String> unitNoList);

	//表计月图表
	List<Map<String, Object>> chartMonthPower(@Param("date") String date, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("unitNoList") List<String> unitNoList);

	//表计年图表
	List<Map<String, Object>> chartYearPower(@Param("date") String date, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("unitNoList") List<String> unitNoList);

	//表计 年区间 图表
	List<Map<String, Object>> chartMonthSection(@Param("startTime") String startTime, @Param("endTime") String endTime, @Param("unitNoList") List<String> unitNoList);

}